package com.warm.pump.executor;


import com.warm.pump.frame.util.SpringBeanUtil;
import com.warm.pump.module.skd.bean.po.gen.ScheduleJob;
import com.warm.pump.module.skd.service.IScheduleJobService;
import com.warm.pump.module.skd.service.impl.ScheduleJobServiceImpl;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * Created by guozj on 2018/1/10.
 */
public class TaskQuartzJob extends QuartzJobBean {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.debug("创建任务实例和实例任务列表 start...");
        ScheduleJob job = (ScheduleJob) jobExecutionContext.getMergedJobDataMap().get("JOB_PARAM_KEY_GROUP");
        IScheduleJobService scheduleJobService = SpringBeanUtil.getBean(ScheduleJobServiceImpl.class);
        scheduleJobService.createInstBySdkJob(job.getId());

        logger.debug("创建任务实例和实例任务列表 end...");
    }
}
